% For now, there are no inputs

close all;
f = figure;
grid on;

% Length of our signal
n = 35;

% Define our input signal
x = ones(1, n);
x(8:15) = 5;

% Define the wind
u1  = ones(1, n);
u1(5:12) = 3;

u2 = sin([1:n]) + 1;
tmp(15:25) = 5;
u2(15:25) = u2(15:25)+((1/10)*(tmp(15:25)).^2);

% Output is y, initialize it to throw in this loop
y1 = x;
y2 = x;

% Define our grid..
N = [1:n];
dx = 1000; % [m]
dt = 120;  % [s]

% Plot properties.
lw = 2;

subplot(2, 1, 1);
hold on;
plot(N, y1, 'k');
plot(N, u1, 'r-');
plot(N, u2, 'b-');
hold off;
axis(gca, [0 n 0 8]);
grid on;

subplot(2, 1, 2);

for I=[1:60]

	y1 = mex_adv1d(y1, u1, dx, dt);
	y2 = mex_adv1d(y2, u2, dx, dt);

	subplot(2, 1, 2);
	plot(N, real(y1), 'r-', N, real(y2), 'b-', N, x, 'k-', 'LineWidth', lw);
	axis(gca, [0 n 0 8]);
	grid on;

	xlabel('Distance (m)');
	ylabel('Concentration');

%	subplot(2, 1, 2);
%	hold on;
%	plot(N, x2_orig, 'k-');
%	plot(N, x2, 'b-');
%	plot(N, u2, 'y-');
%	hold off;

	xlabel('Distance (m)');
	ylabel('Concentration');


	% Pause to make the animation better
	pause(0.1);
end
